//转换日期格式
const formatDate = function (dateValue, format) {
  var date = new Date(dateValue);
  var y = date.getFullYear();
  var m = date.getMonth() + 1;
  m = m < 10 ? ('0' + m) : m;
  var d = date.getDate();
  d = d < 10 ? ('0' + d) : d;
  var h = date.getHours();
  var minute = date.getMinutes();
  minute = minute < 10 ? ('0' + minute) : minute;
  var s = date.getSeconds()
  s = s < 10 ? ('0' + s) : s;
  let time = y + '/' + m + '/' + d
  if (format == 'MM-DD') {
    time = m + '-' + d
  }
  if (format == 'MM') {
    time = m
  }
  if (format == 'YY-MM') {
    time = y + '/' + m
  }
  if (format == 'YY-MM-DD') {
    time = y + '-' + m + '-' + d
  }
  if (format == 'YY-MM-DD HH:mm:ss') {
    time = y + '/' + m + '/' + d + ' ' + h + ':' + minute + ':' + s
  }
  return time
}
Page({

  /**
   * 页面的初始数据
   */
  data: {
    selectDate: "",
    fishCatch_list: [{
        time: '7月29日',
        status: '已结算',
        club: '万顺缘垂钓俱乐部',
        session: '0729正钓鲫鱼7000斤',
        weight: '38.5',
        num: 1,
        price: '231.00'
      },
      {
        time: '7月29日',
        status: '已结算',
        club: '万顺缘垂钓俱乐部',
        session: '0729正钓鲫鱼7000斤',
        weight: '38.5',
        num: 1,
        price: '231.00'
      },
      {
        time: '7月29日',
        status: '已结算',
        club: '万顺缘垂钓俱乐部',
        session: '0729正钓鲫鱼7000斤',
        weight: '38.5',
        num: 1,
        price: '231.00'
      },


    ],

    mode: '',
    monthVisible: false,
    month: '2021-09',
    monthText: '',

    // 指定选择区间起始值
    start: '2023-01-01 00:00:00',
    end: '2030-09-09 12:12:12',
  },
  showSelectDate(e) {

    this.setData({
      monthVisible: true,
    });
  },
  hidePicker() {

    this.setData({
      monthVisible: false,
    });
  },
  onConfirm(e) {
    const {
      value
    } = e.detail;
    const {
      mode
    } = this.data;


    this.setData({
      [mode]: value,
      monthText: value,
      selectDate: value,
    });

    this.hidePicker();
  },

  onColumnChange(e) {
    console.log('pick', e.detail.value);
  },
  toDetail(){
    let info={}
    wx.navigateTo({
      url: `/pages/fishCatchDetail/fishCatchDetail?info=${info}`
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let today = formatDate(new Date())
    this.setData({
      month: today,
      end: today
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})